{% extends "admin/base.html" %}
{% block ext_css %}
    <link href="{{ url_for('static',filename='js/responsive-tables/responsive-tables.css') }}" rel="stylesheet"
          type="text/css">
{% endblock %}
{% block content %}
    <ol class="breadcrumb">
        <li><a href="#">后台</a></li>
        <li class="active">附件管理</li>
    </ol>
    <hr/>
    <div class="box-header well" data-original-title="">
        <h2><i class="glyphicon glyphicon-user red"></i> 附件管理</h2>
    </div>
    <div class="box-content">
        <table id="user" class="table table-striped table-bordered  bootstrap-datatable datatable responsive">
            <thead>
            <tr>
                <th>附件名称</th>
                <th>附件路径</th>
                <th>引用路径</th>
                <th>上传日期</th>
                <th>上传用户</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>
            {% for i in atts %}
                <tr>
                    <td>{{ i.file_name }}</td>
                    <td>{{ i.file_url }}</td>
                    <td>
                        <a href=" {{ url_for('article.show',aid=i.article_id) }}"/>{{ url_for('article.show',aid=i.article_id) }}
                    </td>
                    <td>{{ i.upload_date }}</td>
                    <td>{{ i.upload_user }}</td>
                    <td class="center">
                        <a class="btn btn-info " href="{{ url_for('main.uploaded_file',filename=i.file_name) }}">
                            <i class="glyphicon glyphicon-download-alt icon-white"></i>
                            下载
                        </a>
                        <a class="btn btn-danger" data-trigger="confirm"
                           href="{{ url_for('admin.rmfile',filename=i.file_name,urls='atts') }}">
                            <i class="glyphicon glyphicon-trash icon-white"></i>
                            删除
                        </a>
                    </td>
                </tr>
            {% endfor %}
            </tbody>
        </table>
    </div>
{% endblock %}
{% block script %}
    <script type="text/javascript" src="{{ url_for('static', filename='js/jquery/jquery-2.1.1.js') }}"></script>
    <script type="text/javascript"
            src="{{ url_for('static', filename='ext/DataTables-1.10.3/media/js/jquery.dataTables.js') }}"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            $('#user').dataTable({
                stateSave: true
            });
        });
    </script>
{% endblock %}